﻿<?php


class CityApp extends BaseApp
{


	
    function cagrylist()
    {
		$TB_city = &$this->_model('city');
		 		 		
		$catgydata = $TB_city->show();
		$catgydata = $TB_city->get_list_category($catgydata);

		
        $this->assign('catgydata', $catgydata);				

	    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');		
		
        $this->display('citylist.view.html');
    }


    function cagryadd()
    {
		$TB_city = &$this->_model('city');
		 		 		
		$catgydata = $TB_city->show();
		 		 		
		
		$catgystr = $TB_city->html_format_category($catgydata,0);	

        $this->assign('catgystr', $catgystr);	
		
			    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');		
		
        $this->display('cityadd.view.html');
    }
	
    function editcatgy()
    {

		$id= intval($_GET['id']);
		
		$TB_city = &$this->_model('city');
		 		 		
		$catgydata = $TB_city->show();
		
		$data = $TB_city->oneshow($id);
		
		$catgystr = $TB_city->html_format_category($catgydata,$data['fup']);	

        $this->assign('data', $data);

        $this->assign('catgystr', $catgystr);
		
			    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');		
		
        $this->display('cityedit.view.html');
    }
	

    function cyaddpost()
    {

	     $data = $_POST['data'];
         
		 $TB_city = &$this->_model('city');
		 		 		
		 $TB_city->post($data);
		 
		 $TB_city->write_cache();	
		 	 		 
		 $this->cagrylist();

    }


    function cyeditpost()
    {

	     $id = $_POST['id'];

	     $data = $_POST['data'];
         
		 $TB_city = &$this->_model('city');
		 		 		
		 $TB_city->editaction($id,$data);

		 $TB_city->write_cache();	
		 	 		 
		 $this->cagrylist();

    }



    function delcatgy()
    {
		$id= intval($_GET['id']);		

	    $TB_city = &$this->_model('city');		 		 		
		$TB_city->del($id);
		
		$TB_city->write_cache();
				      
		$this->cagrylist();   
    }	
		
   

  
}

?>